#include <iostream>
#include <vector>

bool isStrictlyAscending(std::vector<int>& arr) {
    if (arr.size() < 2) {
        return false;
    }
    
    for (int i = 0; i < arr.size() - 1; i++) {
        if (arr[i] >= arr[i + 1]) {
            return false;
        }
    }

    return true;
}

bool isStrictlyDescending(std::vector<int>& arr) {
    if (arr.size() < 3) {
        return false;
    }
    
    std::vector<int> diff(arr.size() - 1);
    
    for (int i = 0; i < arr.size() - 1; i++) {
        diff[i] = arr[i + 1] - arr[i];
    }
    
    for (int i = 0; i < diff.size() - 1; i++) {
        if (diff[i] <= diff[i + 1]) {
            return false;
        }
    }

    return true;
}

bool checkArrayCondition(std::vector<int>& arr) {
    return isStrictlyAscending(arr) && isStrictlyDescending(arr);
}

int main() {
    int n;
    std::cout << "请输入数组的大小n：";
    std::cin >> n;
    
    std::vector<int> arr(n);
    
    std::cout << "请输入数组元素ai（用空格分隔）：";
    for (int i = 0; i < n; i++) {
        std::cin >> arr[i];
    }
    
    if (checkArrayCondition(arr)) {
        std::cout << "YES" << std::endl;
    } else {
        std::cout << "NO" << std::endl;
    }
    
    return 0;
}